// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sys

import (
	"context"
	"hotgo/api/admin/stocklhbggtjsina"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	StockLhbGgtjSina = cStockLhbGgtjSina{}
)

type cStockLhbGgtjSina struct{}

// List 查看龙虎榜列表
func (c *cStockLhbGgtjSina) List(ctx context.Context, req *stocklhbggtjsina.ListReq) (res *stocklhbggtjsina.ListRes, err error) {
	list, totalCount, err := service.SysStockLhbGgtjSina().List(ctx, &req.StockLhbGgtjSinaListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.StockLhbGgtjSinaListModel{}
	}

	res = new(stocklhbggtjsina.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出龙虎榜列表
func (c *cStockLhbGgtjSina) Export(ctx context.Context, req *stocklhbggtjsina.ExportReq) (res *stocklhbggtjsina.ExportRes, err error) {
	err = service.SysStockLhbGgtjSina().Export(ctx, &req.StockLhbGgtjSinaListInp)
	return
}

// Edit 更新龙虎榜
func (c *cStockLhbGgtjSina) Edit(ctx context.Context, req *stocklhbggtjsina.EditReq) (res *stocklhbggtjsina.EditRes, err error) {
	err = service.SysStockLhbGgtjSina().Edit(ctx, &req.StockLhbGgtjSinaEditInp)
	return
}

// View 获取指定龙虎榜信息
func (c *cStockLhbGgtjSina) View(ctx context.Context, req *stocklhbggtjsina.ViewReq) (res *stocklhbggtjsina.ViewRes, err error) {
	data, err := service.SysStockLhbGgtjSina().View(ctx, &req.StockLhbGgtjSinaViewInp)
	if err != nil {
		return
	}

	res = new(stocklhbggtjsina.ViewRes)
	res.StockLhbGgtjSinaViewModel = data
	return
}

// Delete 删除龙虎榜
func (c *cStockLhbGgtjSina) Delete(ctx context.Context, req *stocklhbggtjsina.DeleteReq) (res *stocklhbggtjsina.DeleteRes, err error) {
	err = service.SysStockLhbGgtjSina().Delete(ctx, &req.StockLhbGgtjSinaDeleteInp)
	return
}
